home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / vdtj122b.zip / PRINT.VDM < prev    next >
Text File  |  1990-08-07  |  2KB  |  65 lines

  1. !
  2. !    PRINT.VDM    Simple printing macro. Prints the filename and page #
  3. !            on the top of each page. Starts a new page if a <CTRL-L>
  4. !            is in the first column. 
  5. !
  6. !AGAIN!
  7. _B            !Print from the beginning of file
  8.  
  9. ES 8 2 .rvXS(4)        !Suppress error handling; (save old values)
  10. PP 2 0 .rvXS(2)        !Disable page formatting,
  11. PP 3 0 .rvXS(3)        !  allows macro to control entire page
  12. PP 1 .rvXS(5)        !Q5 = number of physical lines per page
  13. 1XS(1)            !Set page counter to 1
  14. YP            !Re-route output to the printer
  15.  
  16. [            !Main print loop
  17. 2YEN            !Print 2 blank lines
  18. @YT/FILE: /
  19. :EW            !Print filename
  20. 30YET            !Tab-out to column 30
  21. (.os>1)[ :OD ]        !If DOS/XENIX print the date
  22. 60YET            !Tab-out to column 60
  23. @YT/PAGE  / -XT(1)    !Print page number, left justified
  24. YEN            !Print 1 more blank line
  25.  
  26. (Q5-6)[            !Print all (60) lines per page, 2 blank lines top & bottom
  27. (.c=^L)[ C JL ]        !Start new page if <Form-Feed> in 1st column
  28. .eof @JP/END/        !Branch on End-of-file
  29. 1_T            !Print one text line, perform auto-buffering if needed
  30. 1_:L            !Advance by 1 line
  31. ]            !End of loop for one page
  32.  
  33. PE            !Page-eject, start new page
  34. (.c=^L)[ C ]        !Ignore next char if it is a <CTRL-L>;
  35.             !  prevents printing blank pages
  36. XA(1)            !Advance page counter
  37.  
  38. ]            !END of main print loop
  39.  
  40. !END!
  41. -YP            !Turn off printer re-routing
  42. PF            !Finish print job
  43.             !MSDOS: just a page eject (same as PE)
  44.             !UNIX: flush and close the print job
  45. PP 2 Q2            !Restore original values...
  46. PP 3 Q3            !"
  47. ES 8 Q4            !"
  48.  
  49. (.mn<>"Z)[ JM ]        !If macro not in register "Z", it is now done
  50.  
  51. !PROMPT!
  52. +@XK(3)/Press "P" to print another file or <ESC> to return to DOS: /
  53. (Q3=27)[ :EX ]        !Back to DOS on <ESC>
  54. (Q3&95)XS(3)        !Convert lowercase to uppercase
  55. (Q3<>"P)[ @JP/PROMPT/    !Prompt over if not <ESC> or "P"
  56.     ][        !ELSE
  57.     +@RQ(y)/Enter name of file to print: /
  58.     :ED|Ry        !Does the file exist?
  59.     (.rv=0)[+@XK(3)/File does not exist.  Press any key to continue /
  60.         @JP/PROMPT/
  61.            ]
  62.     :EY EB|Ry    !Close old file, open new file
  63.     @JP/AGAIN/    !Start over
  64.     ]
  65.